<template>
  <a class="link" @click="jump">
    <!-- 可以渲染标题 -->
    <slot></slot>
  </a>
</template>
<script>
export default {
  props: {
    to: {
      type: String,
      required: true
    }
  },
  methods: {
    jump() {
      // 获取路由器
      const router = this._routerRoot._router;

      router.push(this.to);
    }
  }
};
</script>

<style scoped>
.link {
  margin: 0 10px;
  text-decoration: underline;
  cursor: pointer;
}
</style>